#include<iostream>
using std::endl;
using std::cout;
using std::cin;
class Complex;
class Point{
public:
    Point(int x,int y)
        :_x(x)
         ,_y(y){
             cout<<"Point"<<endl;
         }
    friend class Complex;
    operator Complex();
private:
    int _x;
    int _y;
};
class Complex{
public:
    Complex(double a,double b)
        :_a(a)
         ,_b(b){
             cout<<"Complex"<<endl;
         }
    //隐式
   // explicit
    Complex(const Point& po)
        :_a(po._x)
        ,_b(po._y){
        cout<<"po_Complex"<<endl;
    }
    //重载赋值
    Complex& operator=(const Point&po){
     cout<<"=operator"<<endl;
        _a = po._x;
        _b = po._y;
        return *this;
    }
    void print(){
        cout<<"("
            <<_a<<"+"<<_b<<"i)"<<endl;
    }
private:
     int _a;
     int _b;
};
Point::operator Complex(){
    cout<<"显示"<<endl;
    return Complex(_x,_y);
}
void test0(){
    Point pt(8,9);
    Complex cx(4,6);
    cx = pt;
    cx.print();
}
int main(){
    test0();
    return 0;
}
